package com.example.onion.hxchat.room.entity;

import androidx.annotation.NonNull;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

/**
 * @Entity标签，通过该标签将该类与Room中表关联起来。
 *
 * tableName属性可以为该表设置名字，如果不设置，则表名与类名相同。
 *
 * @PrimaryKey标签用于指定该字段作为表的主键。
 *
 * @ColumnInfo标签可用于设置该字段存储在数据库表中的名字并指定字段的类型。
 *
 * @Ignore标签用来告诉系统忽略该字段或者方法。
 */



@Entity(tableName = "User")
public class User
{
    @PrimaryKey(autoGenerate = true)
    @ColumnInfo(name = "id",typeAffinity = ColumnInfo.INTEGER)
    public int id;

    @ColumnInfo(name = "userId", typeAffinity = ColumnInfo.TEXT)
    public String userId;

    @ColumnInfo(name = "userPwd", typeAffinity = ColumnInfo.TEXT)
    public String userPwd;

    @ColumnInfo(name = "userName", typeAffinity = ColumnInfo.TEXT)
    public  String userName;

    @ColumnInfo(name = "userAge", typeAffinity = ColumnInfo.INTEGER)
    public int userAge;

    @ColumnInfo(name = "userGrade", typeAffinity = ColumnInfo.TEXT)
    public String userGrade;

    @ColumnInfo(name = "userSpy", typeAffinity = ColumnInfo.TEXT)
    public String userSpy;

    @ColumnInfo(name = "userEmail", typeAffinity = ColumnInfo.TEXT)
    public String userEmail;

    @ColumnInfo(name = "userPid", typeAffinity = ColumnInfo.TEXT)
    public String  userPid;

    @ColumnInfo(name = "userTid", typeAffinity = ColumnInfo.TEXT)
    public String userTid;

    @ColumnInfo(name = "userMoney", typeAffinity = ColumnInfo.TEXT)
    public String userMoney;

    @ColumnInfo(name = "userSex", typeAffinity = ColumnInfo.TEXT)
    public String userSex;

    @ColumnInfo(name = "userLabel1", typeAffinity = ColumnInfo.TEXT)
    public String userLabel1;

    @ColumnInfo(name = "userLabel2", typeAffinity = ColumnInfo.TEXT)
    public String userLabel2;

    @ColumnInfo(name = "userLabel3", typeAffinity = ColumnInfo.TEXT)
    public  String userLabel3;

    @ColumnInfo(name = "userLabel4", typeAffinity = ColumnInfo.TEXT)
    public String userLabel4;

    @ColumnInfo(name = "userAbility", typeAffinity = ColumnInfo.TEXT)
    public String userAbility;

    /**
     * Room会使用这个构造器来存储数据，也就是当你从表中得到Student对象时候，Room会使用这个构造器
     * */
    public User(String userId, String userPwd, String userName, int userAge, String userGrade, String userSpy, String userEmail, String userPid, String userTid, String userMoney, String userSex, String userLabel1, String userLabel2, String userLabel3, String userLabel4, String userAbility) {
        this.userId = userId;
        this.userPwd = userPwd;
        this.userName = userName;
        this.userAge = userAge;
        this.userGrade = userGrade;
        this.userSpy = userSpy;
        this.userEmail = userEmail;
        this.userPid = userPid;
        this.userTid = userTid;
        this.userMoney = userMoney;
        this.userSex = userSex;
        this.userLabel1 = userLabel1;
        this.userLabel2 = userLabel2;
        this.userLabel3 = userLabel3;
        this.userLabel4 = userLabel4;
        this.userAbility = userAbility;
    }

    /**
     * 由于Room只能识别和使用一个构造器，如果希望定义多个构造器，你可以使用Ignore标签，让Room忽略这个构造器
     * 同样，@Ignore标签还可用于字段，使用@Ignore标签标记过的字段，Room不会持久化该字段的数据
     * */
    @Ignore
    public User(String userId, String userName, int userAge, String userGrade, String userSpy, String userEmail, String userSex, String userAbility) {
        this.userId = userId;
        this.userName = userName;
        this.userAge = userAge;
        this.userGrade = userGrade;
        this.userSpy = userSpy;
        this.userEmail = userEmail;
        this.userSex = userSex;
        this.userAbility = userAbility;
    }

    public void setUserId(@NonNull String userId) {
        this.userId = userId;
    }

    public void setUserPwd(String userPwd) {
        this.userPwd = userPwd;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public void setUserAge(int userAge) {
        this.userAge = userAge;
    }

    public void setUserGrade(String userGrade) {
        this.userGrade = userGrade;
    }

    public void setUserSpy(String userSpy) {
        this.userSpy = userSpy;
    }

    public void setUserEmail(String userEmail) {
        this.userEmail = userEmail;
    }

    public void setUserPid(String userPid) {
        this.userPid = userPid;
    }

    public void setUserTid(String userTid) {
        this.userTid = userTid;
    }

    public void setUserMoney(String userMoney) {
        this.userMoney = userMoney;
    }

    public void setUserSex(String userSex) {
        this.userSex = userSex;
    }

    public void setUserLabel1(String userLabel1) {
        this.userLabel1 = userLabel1;
    }

    public void setUserLabel2(String userLabel2) {
        this.userLabel2 = userLabel2;
    }

    public void setUserLabel3(String userLabel3) {
        this.userLabel3 = userLabel3;
    }

    public void setUserLabel4(String userLabel4) {
        this.userLabel4 = userLabel4;
    }

    public void setUserAbility(String userAbility) {
        this.userAbility = userAbility;
    }

    @NonNull
    public String getUserId() {
        return userId;
    }

    public String getUserPwd() {
        return userPwd;
    }

    public String getUserName() {
        return userName;
    }

    public int getUserAge() {
        return userAge;
    }

    public String getUserGrade() {
        return userGrade;
    }

    public String getUserSpy() {
        return userSpy;
    }

    public String getUserEmail() {
        return userEmail;
    }

    public String getUserPid() {
        return userPid;
    }

    public String getUserTid() {
        return userTid;
    }

    public String getUserMoney() {
        return userMoney;
    }

    public String getUserSex() {
        return userSex;
    }

    public String getUserLabel1() {
        return userLabel1;
    }

    public String getUserLabel2() {
        return userLabel2;
    }

    public String getUserLabel3() {
        return userLabel3;
    }

    public String getUserLabel4() {
        return userLabel4;
    }

    public String getUserAbility() {
        return userAbility;
    }
}